﻿$(document).ready(function() {
    var time = null;

    var showDrop = function() { $('#drop').stop().animate({ height: "370px", opacity: "0.95" }, 400); $('#all_comic').css("background-color", "Yellow"); }
    var hideDrop = function() { $('#drop').stop().animate({ height: "0px", opacity: "0" }, 400); $('#all_comic').css("background-color", "White"); }

    $('#all_comic').hover(function() {
        clearTimeout(time);
        showDrop();
    }, function() {
        time = setTimeout(function() { hideDrop(); }, 100);
    });
    $('#drop').hover(function() { clearTimeout(time); $(this).show(); }, function() { hideDrop(); });

    $('#d_tab29').DB_rotateRollingBanner({
        key: "c37080",
        moveSpeed: 200,
        autoRollingTime: 5000
    });

    $("#this_week_rank_head").hover(function() {
        $(this).css({ "background-color": "transparent", "color": "#FF5444", "broder-bottom-style": "solid", "border-bottom-width": "0px", "border-bottom-color": "Orange" });
        $("#last_week_rank_head").css({ "color": "White", "background-color": "#FF5444", "broder-bottom-style": "solid", "border-bottom-width": "1px", "border-bottom-color": "Orange" });
        $("#last_week_rank_body").css("display", "none");
        $("#this_week_rank_body").css("display", "block");
    });

    $("#last_week_rank_head").hover(function() {
        $(this).css({ "background-color": "transparent", "color": "#FF5444", "broder-bottom-style": "solid", "border-bottom-width": "0px", "border-bottom-color": "Orange" });
        $("#this_week_rank_head").css({ "color": "White", "background-color": "#FF5444", "broder-bottom-style": "solid", "border-bottom-width": "1px", "border-bottom-color": "Orange" });
        $("#this_week_rank_body").css("display", "none");
        $("#last_week_rank_body").css("display", "block");
    });

    var updateHeadList = $("#update_day_head >li");
    var updateBodyList = $("#update_day_body >li");
    updateHeadList.hover(function() {
        var index = $(this).index();
        updateHeadList.each(function(i) { $(this).css({ "font-weight": "normal", "color": "Gray" }); });
        updateBodyList.each(function(i) { $(this).css("display", "none"); });
        updateHeadList.eq(index).css({ "font-weight": "bold", "color": "Black" });
        updateBodyList.eq(index).css("display", "block");
    });

    var nowDay = new Date().getDay() - 1;
    if (nowDay < 0) nowDay = 6;
    updateHeadList.eq(nowDay).css({ "font-weight": "bold", "color": "Black" });
    updateBodyList.eq(nowDay).css("display", "block");

    var vipHeadList = $("#vip_site_list >li");
    var vipBodyList = $("#vip_site_detail >li");
    vipHeadList.hover(function() {
        var index = $(this).index();
        vipHeadList.each(function(i) { $(this).css({ "font-weight": "normal", "background-color": "transparent" }); });
        vipBodyList.each(function(i) { $(this).css("display", "none"); });
        vipHeadList.eq(index).css({ "font-weight": "bold", "background-color": "#FFC400" });
        vipBodyList.eq(index).css("display", "block");
    });

    var updatingBodyList = $("#updating_body_list >li");
    var updatingContentList = $("#updating_content_list >li");
    var updatingImageList = $("#updating_big_img_list >li");
    updatingBodyList.hover(function() {
        var index = $(this).index();
        updatingContentList.each(function(i) { $(this).css("display", "none"); });
        updatingImageList.each(function(i) { $(this).css("display", "none"); });
        updatingContentList.eq(index).css("display", "block");
        updatingImageList.eq(index).css("display", "block");
    });
});